import loadable from '@loadable/component'

import {COMMON_PATH} from '@/common/constant'
import {PicCenterOutlined,UserOutlined, BarcodeOutlined} from '@ant-design/icons'

const ArticleList = loadable(() => import('./article/ArticleList'))
const ArticleInfo = loadable(() => import('./article/ArticleInfo'))
const UserInfo = loadable(() => import('./user/UserInfo'))
const NotFond = loadable(() => import('./NotFond'))
const Leave = loadable(() => import('./attendance/Leave'))
const AddLeave = loadable(() => import('./attendance/AddLeave'))

const routes = [
  {
    id: 1,
    title: '文章页',
    icon: <PicCenterOutlined />,
    role: ['super','admin', 'shop'],
    children: [
      {
         id: 101,
         title: '文章列表',
         path: COMMON_PATH + '/article/list',
         component: ArticleList,
      },
      {
        id: 102,
        title: '文章详情',
        path: COMMON_PATH + '/article/info',
        component: ArticleInfo,
        // hidden: true,
        role: ['super','admin']
      }
    ]
  },
  {
    id: 3,
    title: '用户管理',
    icon: <UserOutlined />,
    role: ['super'],
    children: [
      {
        id: 301,
        title: '用户信息',
        path: COMMON_PATH + '/user/info',
        component: UserInfo
      }
    ]
  },
  {
    id: 4,
    title: '考勤管理',
    icon: <BarcodeOutlined />,
    // role: ['super'],
    children: [
      {
        id: 401,
        title: '请假加班',
        path: COMMON_PATH + '/attend/leave',
        component: Leave
      },
      {
        id: 402,
        hidden: true,
        title: '添加申请加班',
        path: COMMON_PATH + '/attend/update',
        component: AddLeave
      }
    ]
  }
]

export const syncRoutes = [
  {
    id: 9,
    path: COMMON_PATH + '/404',
    component: NotFond
  }
]

export default routes